package org.jeecg.modules.report.controller;

import java.util.List;
import java.util.Map;

import org.jeecg.modules.report.service.IDepartStoreService;
import org.jeecg.modules.report.vo.departstore.Header;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;

@Api(tags="报表数据API接口")
@RestController
@RequestMapping("/api/report")
@Slf4j
public class ReportController {
	
	@Autowired
	IDepartStoreService departStoreService;
	
	/**
	 * 查出客户订单在各部门存货数据
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/queryDepartStoreData")
    Object queryDepartStoreData(){
		List<Map<String, Object>> list = departStoreService.getCustomerOrderDepartStoreDataList();
		JSONObject jsonObj = new JSONObject();
		jsonObj.put("data", list);
		return jsonObj;
    }
	
	/**
	 * 生成查询列表的顶部Header标题集合
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/queryHeader")
    Object queryHeader(){
		List<Header> list = departStoreService.getHeaderList();
		JSONObject jsonObj = new JSONObject();
		jsonObj.put("data", list);
		return jsonObj;
    }
}
